/// Created by RongCheng on 2022/7/27.

import 'package:flutter/material.dart';
import 'package:flutter_demo/ui/pages/image/browser/drag_gesture_page_route.dart';
import 'package:flutter_demo/ui/pages/image/widgets/simple/drag_page.dart';

class HomeImagePage extends StatefulWidget {
  const HomeImagePage({Key? key}) : super(key: key);

  @override
  State<HomeImagePage> createState() => _HomeImagePageState();
}

class _HomeImagePageState extends State<HomeImagePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text("Drag"),
        ),
        //Hero指的是可以在路由(页面)之间“飞行”的widget。 “添加并覆盖->执行动画->删除”
        //一句话总结：其实就是一个Overlay在2个页面之间进行“添加并覆盖->执行动画->删除”的过程。
        body: Hero(
          tag: "tag1",
          child: GestureDetector(
              onTap: _onTap,
              child: Image.asset(
                "assets/images/yy.png",
                width: 300,
              )),
        ));
  }

  void _onTap() {
    Navigator.push(context, DragGesturePageRoute(builder: (context) {
      return DragPage("assets/images/yy.png");
    }));
  }
}
